import user from './user';
import goods from './goods';
import groupon from './groupon';
import Invite_colleagues from './Invite_colleagues'
import clock_in from './clock_in';
import agency from './agency';
import Invite_labor_dispatch from './Invite_labor_dispatch'
import details from './details'

export function getPosterData(options) {
  switch (options.shareInfo.poster.type) {
    case 'user':
      return user(options);
    case 'goods':
      return goods(options);
    case 'groupon':
      return groupon(options);
    case 'Invite_colleagues':
    return Invite_colleagues(options);
   	case 'clock_in':
      return clock_in(options);
    case 'agency':
      return agency(options);
    case 'Invite_labor_dispatch':
      return Invite_labor_dispatch(options); 
      case 'details':
        return details(options); 
  }
}

export function formatImageUrlProtocol(url) {
  // #ifdef H5
  // H5平台 https协议下需要转换
  // if (window.location.protocol === 'https:' && url.indexOf('http:') === 0) {
  //   url = url.replace('http:', 'https:');
  // }
  // #endif

  // #ifdef MP-WEIXIN
  // 小程序平台 需要强制转换为https协议
  // if (url.indexOf('http:') === 0) {
  //   url = url.replace('http:', 'https:');
  // }
  // #endif

  return url;
}
